{extends 'admin/layout/table-main.tpl'}

{block title}订单管理{/block}
{block smallTitle}系统内的订单管理。{/block}

{block main}
    <div class="row-fluid">
        <div class="span12">
            <section class="panel">
                <div class="portlet box grey" style="margin: auto">
                    <div class="portlet-body">
                        <div style="height: 500px; overflow-x: hidden;;">
                            <table class="table table-striped table-hover">
                                <tbody>
                                    <td>
                                        {foreach $data as $row}
                                            {if $row.pid==$item.id}
                                                <label style="display: inline; width: 200px; float: left"><input type="checkbox" name="classification_id" value="{$row.id}" data-name=" {$row.name}"> {$row.name}</label>
                                            {/if}
                                        {/foreach}
                                    </td>
                                </tbody>
                            </table>
                        </div>

                    </div>
                </div>
            </section>
        </div>
    </div>
{/block}
{block script}
    <script src="{asset('admin/js/plugins/layer/layer.min.js')}"></script>
    <script>
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        parent.layer.iframeAuto(index);

        parent.$('#citybox a').each(function(){
            var id = $(this).find('[name="channel_ids[]"]').val();
            $('[value="'+id+'"]').attr('checked',true)
        });

        // 单个选择
        $('[name="classification_id"]').on('click', function(){
            var name = $(this).attr('data-name');
            var id = $(this).val();
            parent.$('#city_'+id+'').remove();
            if($(this).prop('checked')){
                parent.$('#citybox').append('<a href="javascript:;" id="city_'+id+'">'+name+' <input type="hidden" name="channel_ids[]" value="'+id+'"></a>');
            }

        });

    </script>
{/block}


